"""
#!/usr/bin/python3
# coding:utf-8            
#
# Copyright (C) 2024 - 2024 Jasonakeke， Inc. All Rights Reserved 
# @Desc	   ：
# @Time    : 2024/8/9 22:19
# @Author  : Code_By_Jasonakeke
# @Email   : 2284037977@qq.com
# @File    : 02-cookie.py
# @IDE     : PyCharm
"""
from flask import Flask, make_response, request

app = Flask(__name__)


@app.route('/set')
def hello_world():
	resp = make_response('Hello World!')
	# 默认 cookie 有效时间：浏览器关闭，自动失效
	resp.set_cookie('user_id', 'aaaabbb', max_age = 1800)
	return resp


@app.route('/get')
def get():
    u_id = request.cookies.get('user_id')
    print(u_id)
    return '获得 cookie 的内容'


if __name__ == '__main__':
	app.run(debug = True)
